<template>
  <div class="shop-wrapper">
    <div class="shop-content">
      <ShopHeader></ShopHeader>
      <div class="tab">
            <!-- 使用replace的方式进行路由切换 （路由懒加载） -->
            <div class="tab-item">
                <router-link  to="/shop/goods" replace>点菜</router-link>
            </div>
            <div class="tab-item">
                 <router-link  to="/shop/rating" replace>评价</router-link>
            </div>
            <div class="tab-item">
                 <router-link  to="/shop/shopInfo" replace>商家</router-link>
            </div>
        </div>
         <!-- 缓存路由组件对象 -->
        <keep-alive>
          <router-view/>
        </keep-alive>
    </div>
  </div>
</template>

<script>
import ShopHeader from '../../components/ShopHeader/ShopHeader.vue'
export default {
  mounted () {
        this.$store.dispatch('shopInfo/getShopInfo') 
  },
  components: {
    ShopHeader
  }
}
</script>


<style lang="stylus" rel="stylesheet/stylus">
  @import "../../common/stylus/mixins.styl"
  .shop-wrapper
    .shop-content
      .tab
        height 40px
        line-height 40px
        background #fff
        bottom-border-1px(rgba(7, 17, 27, 0.1))
        .tab-item
          float left
          width: 33.33333%
          text-align center
          font-size 14px
          color #ffbe11
          a
            display block
            position relative
            &.router-link-active
              color #ffbe11
              &::after
                content ''
                position absolute
                left 50%
                bottom 1px
                width 35px
                height 2px
                transform translateX(-50%)
                background #ffbe11
</style>
